package com.aaa.service.impl;

import com.aaa.entity.DO.RentExpireExamine;
import com.aaa.entity.result.Result;
import com.aaa.mapper.RentExpireExamineMapper;
import com.aaa.service.RentExpireExamineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：陈凯歌
 * @date ：Created in 2021/1/30 19:26
 * @description：RentExpireExamine租金到期操作接口实现类
 * @modified By：
 * @version: 1.0
 */
@Service
public class RentExpireExamineServiceImpl implements RentExpireExamineService {

    @Autowired
    private RentExpireExamineMapper mapper;

    /**
     * 根据到期租金id查询详细操作
     * @param id
     * @return
     */
    @Override
    public Result getAll(Integer id) {
        List<RentExpireExamine> all = mapper.getAll(id);
        if (all!=null && all.size()>0){
            return Result.succeed(all);
        }
        return Result.error("查询失败");
    }

    /**
     * create by: 陈凯歌
     * description: 根据前端传入对象进行修改
     * create time: 2021/2/2 16:31
     *
      * @Param: null
     * @return
     */

    @Override
    public Result upExamine(RentExpireExamine rentExpireExamine) {

        //调用修改方法，将传入实体类对象作为参数传入
        int i = mapper.updateById(rentExpireExamine);
        //判断受影响的列大于0
        if (i>0){
            //返回成功
            return Result.succeed("修改成功");
        }
        return Result.error("修改失败");
    }
}
